
#include "transport/pps/pps_proxy.h"

namespace motovis {
namespace transport {

PpsProxy::PpsProxy()
{
    m_thread = std::make_shared<std::thread>(std::bind(&PpsProxy::exec, this));
}

PpsProxy::~PpsProxy()
{
    printf("pps proxy destruct.\n");
    m_thread->join();
}

void PpsProxy::exec()
{
    while (1) {}
}

void PpsProxy::subscribe(const std::string &channelName, Callback &cb)
{
    std::shared_ptr<pps::PPS> pps(new (std::nothrow) pps::PPS(channelName, true));
    m_pps.push_back(pps);

    pps->subscribe(cb);
}

} // namespace transport
} // namespace motovis
